package com.song.tools.songtest.manager;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.song.tools.core.util.ObjectUtils;
import com.song.tools.mvc.manager.BaseManager;
import com.song.tools.songtest.beans.bo.DictionaryDetailBo;
import com.song.tools.songtest.beans.query.DictionaryDetailQuery;
import com.song.tools.songtest.convertor.DictionaryDetailConvertor;
import com.song.tools.songtest.dao.entity.DictionaryDetail;
import com.song.tools.songtest.dao.mapper.DictionaryDetailMapper;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 字典明细表 管理类
 * </p>
 *
 * @author song tools
 * @since 2024-07-09
 */
@Component
public class DictionaryDetailManager extends BaseManager<DictionaryDetail, DictionaryDetailBo, DictionaryDetailMapper, DictionaryDetailQuery, Long, DictionaryDetailConvertor> {

    @Override
    public LambdaQueryWrapper<DictionaryDetail> encapsulateQueryWrapper(DictionaryDetailQuery query) {
        LambdaQueryWrapper<DictionaryDetail> queryWrapper = super.encapsulateQueryWrapper(query);
        if (query == null) {
            return queryWrapper;
        }

        // 组装查询条件
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getId()), DictionaryDetail::getId, query.getId());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getDictionaryId()), DictionaryDetail::getDictionaryId, query.getDictionaryId());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getDictionaryDetailId()), DictionaryDetail::getDictionaryDetailId, query.getDictionaryDetailId());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getDictionaryValue()), DictionaryDetail::getDictionaryValue, query.getDictionaryValue());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getDictionaryValueCode()), DictionaryDetail::getDictionaryValueCode, query.getDictionaryValueCode());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getDictionaryValueName()), DictionaryDetail::getDictionaryValueName, query.getDictionaryValueName());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getStatus()), DictionaryDetail::getStatus, query.getStatus());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getRemark()), DictionaryDetail::getRemark, query.getRemark());
        queryWrapper.eq(ObjectUtils.isNotEmpty(query.getOrdered()), DictionaryDetail::getOrdered, query.getOrdered());
        queryWrapper.ge(ObjectUtils.isNotEmpty(query.getCreateTimeStart()), DictionaryDetail::getCreateTime, query.getCreateTimeStart());
        queryWrapper.le(ObjectUtils.isNotEmpty(query.getCreateTimeEnd()), DictionaryDetail::getCreateTime, query.getCreateTimeEnd());
        queryWrapper.ge(ObjectUtils.isNotEmpty(query.getUpdateTimeStart()), DictionaryDetail::getUpdateTime, query.getUpdateTimeStart());
        queryWrapper.le(ObjectUtils.isNotEmpty(query.getUpdateTimeEnd()), DictionaryDetail::getUpdateTime, query.getUpdateTimeEnd());

        return queryWrapper;
    }

}
